﻿@model IEnumerable<DDDSample.UI.Mvc.Models.CargoViewModel>
@{
    ViewBag.Title = "List of all cargos";
}
<h2>
    List of all cargos. To book a new cargo @Html.ActionLink("click here", "NewCargo")
</h2>
<table border="1" width="800">
    <thead>
        <tr>
            <td>
                Tracking ID
            </td>
            <td>
                Origin
            </td>
            <td>
                Destination
            </td>
            <td>
                Routed
            </td>
            <td>
            </td>
        </tr>
    </thead>
    <tbody>
        @foreach (var cargo in Model)
        {
            <tr>
                <td>
                    @Html.ActionLink(cargo.Id.ToString(), "CargoDetails", new { id = cargo.Id.ToString() })
                </td>
                <td>
                    @cargo.Origin 
                </td>
                <td>
                    @cargo.Destination
                </td>
                <td>
                    @(cargo.IsRouted ? "Yes" : "No")
                </td>
                <td>
                    @Html.ActionLink("new handling event", "RegisterHandlingEvent", "Handling", new { id = cargo.Id.ToString() }, null)
                    @Html.ActionLink("track", "Track", "Tracking", new { id = cargo.Id.ToString() }, null)
                </td>
            </tr>
        }
    </tbody>
</table>
